/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package libs.Extends;

import herostats.Data;

/**
 *
 * @author PHENOM II
 */
public class HeroTotalTablemodel extends AbstractNTablemodel {

    public static Class[] columnClass = {String.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class};
    public static String[] columns = {"Name", "Kills", "Deaths", "Assists", "CreepK", "CreepD",
        "NeutralK", "GameCount", "Wins", "Loses", "Left", "Draws"};
    

    public HeroTotalTablemodel(Data data) {
        this.data = data;
        key = data.getHeros().keySet().toArray(key);
    }

    @Override
    public int getRowCount() {
        return key.length;
    }

    @Override
    public int getColumnCount() {
        return columns.length;
    }

    @Override
    public String getColumnName(int column) {
        if (column < columns.length && column >= 0) {
            return columns[column];
        }
        return "Default";
    }

    @Override
    public boolean isCellEditable(int row, int column) {
        return false;
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        //    return Object.class;
        return columnClass[columnIndex];
    }

    @Override
    public Object getValueAt(int row, int column) {
        if (column == 0) {
            return key[row];
        } else {
            return data.getHeros().get(key[row]).getTotalValueAt(column);
        }
    }

    @Override
    public void setValueAt(Object aValue, int row, int column) {
        //unused
    }
}
